<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'处理'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
        <!-- <div class="analyItem">
            <p class="analyItemTit tx-center"></p>
            <div class="analyItemCon">
            </div>
        </div> -->
    </div>
    <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
                <p class="col-md-10 ">
                    <span class="col-md-1 cLightGray ">备注</span>
                    <span  class="col-md-8 ">
                        <el-input v-model="inputHandel"  placeholder="请输入处理备注..."></el-input>
                    </span>
                </p>
               <span class="circlemark circlemark-purple">待</span>
            </div>
        </div>
         <div class="tx-center">
                 <el-button @click="saveTrickData" type="primary">转入下一个阶段</el-button>
                 <p class="fr pr20">
                    <el-button @click="updateManagePeiReturnFlag"  type="warning">退回</el-button>
                 </p>
        </div>
    </div>
</div>
</template>
<script>
import { mapGetters, mapMutations } from 'vuex'
import { updateManagePeiReturnFlag, saveTrickData } from '../../Resources/Api'
export default {
    data () {
        return {
            inputHandel: '',
            bigStageList: [],
            bigStageTrainList: [],
            nextSum: 0,
            zhuanId: 1
        }
    },
    created () {
        this.bigStageList = this.$route.query.bigStageList
        this.bigStageTrainList = this.$route.query.bigStageTrainList
        this.nextSum = this.$route.query.nextSum
    },
    computed: {
        ...mapGetters(['leftInfo', 'userInfo'])
    },
    methods: {
        ...mapMutations({
            setUpDatePlate: `SET_UPDATE_PLATE`
        }),
        updateManagePeiReturnFlag () {
            updateManagePeiReturnFlag({
                user_card_no: this.leftInfo.cardNo // 卡号'01000378' //
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    layer.msg('退回成功')
                }
            }).catch(error => {
                console.log(error)
            })
        },
        saveTrickData () {
            if (this.inputHandel === '') {
                layer.msg('输入备注')
                return
            }
            if (this.nextSum === 0) {
                this.zhuanId = 52
                if (this.bigStageList.indexOf(null) > 0 || this.bigStageList.indexOf(null) === 0) {
                    layer.msg('尚有信息未完善')
                    return
                }
            } else if (this.nextSum === 1) {
                this.zhuanId = 0
                if (this.bigStageTrainList.indexOf(null) > 0 || this.bigStageTrainList.indexOf(null) === 0) {
                    layer.msg('尚有信息未完善')
                    return
                }
            }

            saveTrickData({
                user_card_no: this.leftInfo.cardNo, // 卡号
                userName: this.leftInfo.userName, // 姓名
                remake: this.inputHandel, // 备注
                operatorCard: this.userInfo.as_cardNo, // 操作人
                operatorName: this.userInfo.as_userName, // 操作人姓名
                exclusiveId: this.zhuanId // 专属ID
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    layer.msg('保存成功')
                    this.setUpDatePlate()
                    this.$router.push(this.$route.matched[1].path)
                }
            }).catch(error => {
                console.log(error)
            })
        },
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        }
    },
    watch: {
        $route () {
        }
    }
}
</script>
<style lang="scss" scoped>
.pointer {
  cursor: pointer;
}
</style>
